package com.atguigu.spring.factory;

import java.util.HashMap;
import java.util.Map;

/**
 * 
 * @author macbook
 *静态工厂方法：直接调用某类的静态方法获取bean的实例
 */
public class StaticCarFactory {
    private static Map<String,Car> cars = new HashMap<String,Car>();
    static{
    	cars.put("audi",new Car("audi",1000000));
    	cars.put("force",new Car("force",4000000));
    }
    //静态工厂方法
    public static Car getCar(String name){
    	return cars.get(name);
    }
}
